<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>修改个人主页</title>
<!-- Bootstrap -->
<link href="${pageContext.request.contextPath}/css/bootstrap.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/editPerson.css"
	rel="stylesheet">
<script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/myjs/search_back.js"></script>
<script src="${pageContext.request.contextPath}/myjs/getImgURL.js"></script>
<script type="text/javascript">
	var count = 1;
	var c = 2;
	$(function(){
		$("#save").click(function(){
			
			window.location.href = "${pageContext.request.contextPath}/personal/savePersonalInfo.action";
			return false;
			}
		);
		//选择咨询时间
		var p_time=$("#p_time").text();
		$("option:contains("+p_time+"):last").remove();
		alert(p_time);
		//选择咨询时间段
		var p_time1=$("#p_time1").text();
		$("option:contains("+p_time1+"):last").remove();
		alert(p_time1);
	});
	
	
	$(function(){
		
		/*
		//复选框测试
		$("input[type='checkbox']").change(function(){
			var time=$("input[type='checkbox']:checked");
			for(var i=0;i<time.length;i++)
			alert($("input[type='checkbox']:checked:eq("+i+")").val());
		})*/
		/*
		var time=$("input[type='checkbox']");
		var array = new Array();
		for(var i=0;i<time.length;i++)
		{
		array[i] = time[i].value;
		}
		alert(array);
		//利用ajax传递时间段值
		$.ajax({
			url:"/WEB22/ajaxServlet2",
			async:true,
			type:"POST",
			data:{"p_time1":"lucy","p_time2":18,"p_time3":"666"},
			success:function(data){
				alert(data.name);
			},
			error:function(){
				alert("请求失败");
			},
			dataType:"json"
		});*/
	});
	
	function creatImg(imgRUL) { //根据指定URL创建一个Img对象  
		var textHtml = "<td class='myPicture' id='count"+count+"'><img src='"+imgRUL+"' width='190px' height='190px'/></td>";
		var textHtml0 = "<td class='myPicture' name='addMyPicture' id='addMyPicture"+c+"'><label for='addPicture' style='cursor: pointer; padding-left: 33%'>图片上传</label> <input type='file'  name='MyPicture"
				+ c
				+ "' id='addPicture' onchange='getImgURL(this)' style='position: absolute; clip: rect(0, 0, 0, 0);'></td>";
		if (count < 4) {
			$("#addMyPicture" + count).replaceWith(textHtml);
			$("#count" + count).after(textHtml0);
		} else if (count == 4) {
			$("#addMyPicture" + count).replaceWith(textHtml);
		} else {
			alert("已经添加足够多的照片了!");
		}
		count++;
		c++;
	}
</script>

<style>
</style>
</head>
<body>
	<!--导航部分    -->
	<jsp:include page="../partial_jsp/header.jsp" flush="true" />
	<!--简介部分 -->
	<form action="${pageContext.request.contextPath}/personal/savePersonalInfo.action"
		enctype="multipart/form-data" method="post" >
		<div class="row" style="padding-top: 50px;">
			<div class="col-lg-2" style="visibility: hidden;"><input type="text" name="p_id" value="${personalInfo.p_id}" style="visibility: hidden;"/></div>
			<div class="col-lg-2"
				style="text-align: center; width: 200px; height: 200px;">
				<div
					style="border: 2px solid red; width: 195px; height: 195px; text-align: center;"><img src="${personalInfo.p_img  }"/> </div>
			</div>

			<div class="col-lg-5" style="padding-left: 20px;">
				姓 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：<input type="text"
					placeholder="请在这里修改用户名" name="p_name" value="${personalInfo.p_name }">
				<hr>
				<p>
					地 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：<input type="text"
						placeholder="请在这里修改地址" name="p_adress" value="${personalInfo.p_adress }">
				</p>
				咨询方式：<input type="text" placeholder="请在这里添加咨询方式" name="p_way" value="${personalInfo.p_way }">
				<hr>
				<label for="xfile" style="cursor: pointer;">图片上传</label> <input
					type="file" id="xfile"
					style="position: absolute; clip: rect(0, 0, 0, 0);">
			</div>

			<div class="col-lg-9" style="padding-top: 50px; padding-left: 17.9%;">
				<div
					style="border-left: 3px solid #4CAE4C; padding-left: 1px; border-top: 1px solid #9D9D9D;">
					<h3>写给咨询者</h3>
					<font size="3"><textarea rows="5" cols="60"
							style="width: 763px; height: 144px; resize: none" name="p_need" vale="${personalInfo.p_need }"></textarea>
					</font>
				</div>
			</div>
			<div class="col-lg-9" style="padding-top: 50px; padding-left: 17.9%;">
				<div style="border-top: 3px solid #4CAE4C; padding-left: 1px;">
					<h3>个人介绍</h3>
					<font size="3"><textarea rows="5" cols="60"
							style="width: 763px; height: 144px; resize: none" name="p_info" vale="${personalInfo.p_info }"></textarea>
					</font>
				</div>
			</div>
			<div class="col-lg-9" style="padding-top: 50px; padding-left: 17.9%;">
				<div
					style="border-left: 3px solid #4CAE4C; padding-left: 1px; border-top: 1px solid #9D9D9D;">
					<h3>擅长的方向</h3>
					<font size="3"><textarea rows="5" cols="60"
							style="width: 763px; height: 144px; resize: none"
							name="p_direction" vale="${personalInfo.p_direction }"></textarea> </font>
				</div>
			</div>
			<div class="col-lg-9" style="padding-top: 50px; padding-left: 17.9%;">
				<div
					style="border-left: 3px solid #4CAE4C; padding-left: 1px; border-top: 1px solid #9D9D9D;">
					<h3>我的相册</h3>
					<table>
						<tr>
							<td class="myPicture" name="addMyPicture" id="addMyPicture1">
								<label for="addPicture"
								style="cursor: pointer; padding-left: 33%">图片上传</label> <input
								type="file" name="MyPicture1" id="addPicture"
								onchange="getImgURL(this)"
								style="position: absolute; clip: rect(0, 0, 0, 0);">
							</td>
						</tr>
					</table>

				</div>
			</div>

			<div class="col-lg-9"
				style="padding-top: 50px; padding-left: 17.9%; margin-bottom: 60px">
				<div
					style="border-left: 3px solid #4CAE4C; padding-left: 1px; border-top: 1px solid #9D9D9D;">

					<h3>可预约时间(北京时间)</h3>
					<table>
						<tr>
							<td><select name="p_time" autocomplete="off">
									<option selected="selected" id="p_time">${personalInfo.p_time==null?'请选择':personalInfo.p_time }</option>
									<option>周一</option>
									<option>周二</option>
									<option>周三</option>
									<option>周四</option>
									<option>周五</option>
									<option>周六</option>
							</select></td>
						</tr>
						<tr>
							<td><select name="p_time1" autocomplete="off">
									<option selected="selected" id="p_time1">${personalInfo.p_time1==null?'请选择':personalInfo.p_time1 }</option>
									<option>上午(8.00-11.00)</option>
									<option>下午(2.00-5.00)</option>
							</select></td>
						</tr>
					</table>
				</div>
				<div style="text-align: center;">
					<button id="save"  >保存</button>
					<input type="submit" value="提交">
				</div>
			</div>

		</div>
	</form>

	<!-- 尾页-->

	<jsp:include page="../partial_jsp/tail.jsp" flush="true"></jsp:include>
</body>
</html>